<!--
	读取的列
-->
<template>
	<view class="device-list-item" @click="toReadDetails">
        <view class="device-info">
			<view class="device-id">
				<text class="id">ID: {{content.mid}}</text>
				<text>未读取</text>
			</view>
			<view class="device-tool">
				<!-- 电量 -->
				<view class="device-tool-battery">
					<power-icon :showText="true"></power-icon>
				</view>
				<!-- 信号 -->
				<view class="device-tool-rssi">
					<rssi-icon :value="content.RSSI + 100"></rssi-icon>
				</view>
				<!-- 状态 -->
				<view class="device-tool-state">
					<view class="icon iconfont icon-state"></view>
					<text>未读取</text>
				</view>
			</view>
			<view class="device-time">
				<text>记录时间: {{content.nowtempTime}}</text>
			</view>
		</view>
		<view class="device-warning">
			<view class="icon iconfont icon-yujing"></view>
			<text>19.2℃</text>
		</view>
    </view>
</template>

<script>
    import rssiIcon from '@/components/utils-ui/rssi-icon.vue'
	import powerIcon from '@/components/utils-ui/power-icon.vue'
	export default {
        props: {
            // 数据
            content: {
                type: Object,
                default: () => {
                    return {}
                }
            }
        },
        components: {
			'rssi-icon': rssiIcon, // 信号图标
			'power-icon': powerIcon // 电池图标
		},
		methods: {
			// 点击查看详情
			// 跳转查看详情页
			toReadDetails() {
				const content = this.content
				uni.navigateTo({
					url: `/pages/read-details/read-details?id=${content.deviceId}`,
					animationType: 'slide-in-right'
				})
			}
		}
	}
</script>

<style lang="less" scoped>
// 左右布局
.space-between {
	display: flex;
	justify-content: space-between;
}
// 设备列表
.device-list-item {
	.space-between;
	// 信息
	.device-info {
		.device-id {
			color: #333;
			> text.id {
				font-size: 1.15em;
				margin-right: 16rpx;
			}
		}
		// 工具
		.device-tool {
			display: flex;
			align-items: center;
			margin: 20rpx 0;
			> view {
				line-height: 1;
				margin-right: 20rpx;
				font-size: .875em;
				&:last-child {
					margin: 0;
				}
			}
			.device-tool-state {
				.space-between;
				align-items: center;
				color: #1296db;
				line-height: 1;
				> text, .icon {
					font-size: .875em;
				}
				> text {
					color: #888;
					margin-left: 10rpx;
				}
			}
		}
		// 记录时间
		.device-time {
			color: #888;
			font-size: .875em;
		}
	}
	// 报警
	.device-warning {
		.space-between;
		align-items: center;
		.icon {
			color:#f44336;
			margin-right: 10rpx;
		}
		text {
			font-size: 1.15em;
		}
	}
}
</style>
